/**
 * JAVACC DEMO 1.0
 * @copy right apache company All rights reserved. 
 * @Package com.apache.rpc.service.plugins  
 */
package com.apache.rpc.service.plugins;

import java.util.List;

import com.apache.api.manager.PluginConnector;
import com.apache.api.vo.ParamsVo;
import com.apache.api.vo.ResultEntity;
import com.apache.database.constant.Validator;
import com.apache.rpc.entity.InterfaceRegister;
import com.apache.rpc.manager.InterfaceRegisterManager;

/**
 * description:  获取接口注册信息插件实现
 * @author Hou Dayu 创建时间：2016-12-9
 * @Copyright(c)2014:
 */
public class InterfaceRegistersPlugin implements PluginConnector {

	private InterfaceRegisterManager interfaceRegisterManager;

	/**
	 * 获取接口注册信息功能实现.  
	 * @see PluginConnector#execute(ParamsVo)
	 */
	@Override
	public Object execute(ParamsVo param) throws Exception {
		ResultEntity result = new ResultEntity();
		List<InterfaceRegister> list = interfaceRegisterManager.getList(new ParamsVo<InterfaceRegister>());
		if (!Validator.isEmpty(list)) {
			result.setEntity(list);
			result.setResult("true");
			result.setMessage("接口调用成功");
		} else {
			result.setResult("false");
			result.setMessage("没有配置相关接口注册信息");
		}
		return result;
	}

	public void setInterfaceRegisterManager(InterfaceRegisterManager interfaceRegisterManager) {
		this.interfaceRegisterManager = interfaceRegisterManager;
	}

}
